package JdbcTest1;
package org.sqlite.test; 
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.sql.Statement; 
import java.util.Properties;
import android.util.Log;
public class JDBCTest1 {
public class java {
	static final String LOG_TAG = "JDBCTest1";
	private Connection conn;
	private Statement stat;
	private String dbpath;
	public JDBCTest1(String dbpath)
	{       
		this.dbpath = dbpath;     }
	private void connect(String dbfile) throws Exception 
	{       new File(dbfile).delete();
	Properties info = new Properties(); 
	Class.forName("org.sqlite.JDBC"); 
	conn = DriverManager.getConnection("jdbc:sqlite:" + dbfile);
	stat = conn.createStatement();    
	}        
	private void close() throws SQLException
	{         
		stat.close();
		conn.close();     }
	private void testUpdate() throws SQLException
	{          
		conn.prepareStatement("create table s1 (c1);").executeUpdate(); 
		PreparedStatement prep = conn.prepareStatement("insert into s1 values (?);");
		prep.setInt(1, 3); 
		prep.executeUpdate(); 
		prep.setInt(1, 5);  
		prep.executeUpdate();
		prep.setInt(1, 7);
		prep.executeUpdate();
		prep.close();
		ResultSet rs = stat.executeQuery("select sum(c1) from s1;"); 
		rs.next();
		Log.d(LOG_TAG, "testUpdate result = " + rs.getInt(1)); 
		rs.close(); 
		} 
	}
}
